<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>
      <?php echo $title; ?> - <?php echo C('STIE_NAME'); ?>
    </title>
    <link rel="stylesheet" href="//at.alicdn.com/t/font_24081_lyaxcfn8fp1iqkt9.css">
    <link rel="stylesheet" href="/P201704/bbs/Public/layui/css/layui.css">
    <link rel="stylesheet" href="/P201704/bbs/Public/css/global.css"
    charset="utf-8">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="/P201704/bbs/Public/layui/layui.js">
    </script>
  </head>
  
  <body>
    <div class="fly-header layui-bg-black">
      <div class="layui-container">
        <a class="fly-logo" href="/P201704/bbs">
          <img src="//res.layui.com/images/fly/logo.png" alt="layui">
        </a>
        <ul class="layui-nav fly-nav layui-hide-xs">
          <li class="layui-nav-item">
            <a href="/">
              <i class="iconfont icon-jiaoliu">
              </i>
              交流
            </a>
          </li>
          <li class="layui-nav-item">
            <a href="/case/2017/">
              <i class="iconfont icon-iconmingxinganli">
              </i>
              案例
            </a>
          </li>
          <li class="layui-nav-item">
            <a href="http://www.layui.com/">
              <i class="iconfont icon-ui">
              </i>
              框架
            </a>
          </li>
        </ul>

        <?php if(!isset($_SESSION['uid'])){ ?>

        
        <ul class="layui-nav fly-nav-user">
          <li class="layui-nav-item">
            <a class="iconfont icon-touxiang layui-hide-xs" href="/user/login/">
            </a>
          </li>
          <li class="layui-nav-item">
            <a href="./xbslogin.html">
              登入
            </a>
          </li>
          <li class="layui-nav-item">
            <a href="<?php echo U('home/reg/index');?>">
              注册
            </a>
          </li>
          <li class="layui-nav-item layui-hide-xs">
            <a href="<?php echo U('home/login/qqlogin');?>" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})"
            title="QQ登入" class="iconfont icon-qq">
            </a>
          </li>
          <li class="layui-nav-item layui-hide-xs">
            <a href="/app/weibo/" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})"
            title="微博登入" class="iconfont icon-weibo">
            </a>
          </li>
        </ul>
        <?php }else{ ?>

        
        <ul class="layui-nav fly-nav-user">
          <li class="layui-nav-item" style="">
            <a class="fly-nav-avatar" href="javascript:;">
              <cite class="layui-hide-xs">
                <?php echo $_SESSION['nickname'] ?>
              </cite>
              <img src="/P201704/bbs/<?php echo $_SESSION['face'] ?>">
              <span class="layui-nav-more">
              </span>
            </a>
            <dl class="layui-nav-child layui-anim layui-anim-upbit">
              <dd>
                <a href="<?php echo U('home/set/index');?>">
                  <i class="layui-icon">
                    
                  </i>
                  基本设置
                </a>
              </dd>
              <dd>
                <a href="/user/message/">
                  <i class="iconfont icon-tongzhi" style="top: 4px;">
                  </i>
                  我的消息
                </a>
              </dd>
              <dd>
                <a href="/u/1962072">
                  <i class="layui-icon" style="font-size: 22px;">
                    
                  </i>
                  主页
                </a>
              </dd>
              <dd>
                <a href="<?php echo U('home/login/logout');?>">
                  <i class="iconfont icon-tuichu" style="top: 0; font-size: 21px;">
                  </i>
                  退出
                </a>
              </dd>
            </dl>
          </li>
          </span>
        </ul>

        <?php } ?>
      </div>
    </div>


    <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>

<script type="text/javascript">
    wx.config({
      debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
      appId: '<?php echo $appId ?>', // 必填，公众号的唯一标识
      timestamp: <?php echo $timestamp ?>, // 必填，生成签名的时间戳
      nonceStr: '<?php echo $nonceStr ?>', // 必填，生成签名的随机串
      signature: '<?php echo $signature ?>',// 必填，签名，见附录1
      jsApiList: ['onMenuShareTimeline','onMenuShareQQ','chooseImage','uploadImage','startRecord','stopRecord','playVoice','stopVoice','translateVoice'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
    });


    wx.ready(function(){
        wx.onMenuShareTimeline({
            title: '<?php echo $title ?>', // 分享标题
            link: '<?php echo $url ?>', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
            imgUrl: 'https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png', // 分享图标
            success: function () {
                alert(888) 
                // 用户确认分享后执行的回调函数
            },
            cancel: function () { 
               alert('取消');
                // 用户取消分享后执行的回调函数
            }
        });


        wx.onMenuShareQQ({
          title: '<?php echo $title ?>', // 分享标题
          desc: '这个是我从微信分享过来的', // 分享描述
          link: '<?php echo $url ?>', // 分享链接
          imgUrl: 'https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png', // 分享图标
          success: function () { 
             // 用户确认分享后执行的回调函数
          },
          cancel: function () { 
             // 用户取消分享后执行的回调函数
          }
      });

        $('#btn').click(function(event) {
            wx.chooseImage({
              count: 2, // 默认9
              sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
              sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
              success: function (res) {
                  localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
                  alert(localIds);

                  wx.uploadImage({
                      localId:localIds[0], // 需要上传的图片的本地ID，由chooseImage接口获得
                      isShowProgressTips: 1, // 默认为1，显示进度提示
                      success: function (res) {
                          var serverId = res.serverId; 
                          alert(serverId);
                          // 返回图片的服务器端ID
                      }
                  });
              }
          });
        });

        $('#start').click(function(event) {
            wx.startRecord();
        });
        $('#stopl').click(function(event) {
            wx.stopRecord({
                success: function (res) {
                    luyin = res.localId;
                }
            });
        });

        $('#play').click(function(event) {
          // alert(888)
            wx.playVoice({
                localId: luyin 
            });
        });

        $('#stopp').click(function(event) {
            wx.stopVoice({
                localId: luyin // 需要停止的音频的本地ID，由stopRecord接口获得
            });
        });

        $('#fy').click(function(event) {
            wx.translateVoice({
               localId: luyin, // 需要识别的音频的本地Id，由录音相关接口获得
                isShowProgressTips: 1, // 默认为1，显示进度提示
                success: function (res) {
                    alert(res.translateResult); // 语音识别的结果
                }
            });
        });




    });

</script>


<div class="layui-container">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md8 content detail">
      <div class="fly-panel detail-box">
        <h1><?php echo $ques['title']; ?></h1>
        <div class="fly-detail-info">
          <input type="button" id="btn" value="打开相册">
          <input type="button" id="start" value="开始">
          <input type="button" id="stopl" value="停止">
          <input type="button" id="play" value="播放">
          <input type="button" id="stopp" value="停止播放">
          <input type="button" id="fy" value="翻译">
          <!-- <span class="layui-badge layui-bg-green fly-detail-column"><?php echo $ques['cname']; ?></span>
          <span class="layui-badge" style="background-color: #999;"><?php echo $ques['status']; ?></span>
          <span class="layui-badge layui-bg-red"><?php echo $ques['good']; ?></span>
          <div class="fly-admin-box" data-id="15866"></div>
          <span class="fly-list-nums">
            <a href="#comment">
              <i class="iconfont" title="回答"></i><?php echo $ques['answer_num']; ?></a>
            <i class="iconfont" title="人气"></i><?php echo $ques['view_num']; ?></span> -->
            </div>
        <div class="detail-about">
          <a class="fly-avatar" href="/u/3279696/">
            <img src="/P201704/bbs/<?php echo $ques['face']; ?>" alt="Jim0090"></a>
          <div class="fly-detail-user">
            <a href="/u/3279696/" class="fly-link">
              <cite><?php echo $ques['nickname']; ?></cite></a>
            <span><?php echo Ftime($ques['ctime']); ?></span></div>
          <div class="detail-hits" id="LAY_jieAdmin" data-id="15866">
            <span style="padding-right: 10px; color: #FF7200">悬赏：<?php echo $ques['kiss']; ?>飞吻</span>
            <?php if($is_collect) { ?>

            <span class="layui-btn layui-btn-mini jie-admin layui-btn-danger" type="collect" id="collect"
             data-type="add" qid="<?php echo $ques['qid'] ?>">取消收藏</span></div>

            <?php }else{ ?>

            <span class="layui-btn layui-btn-mini jie-admin " type="collect" id="collect"
             data-type="add" qid="<?php echo $ques['qid'] ?>">收藏</span></div>

            <?php  }?>
            
        </div>
        <div class="detail-body photos"><?php echo htmlspecialchars_decode($ques['content']); ?></div></div>
      <div class="fly-panel detail-box" id="flyReply">
        <fieldset class="layui-elem-field layui-field-title" style="text-align: center;">
          <legend>回帖</legend></fieldset>
        <ul class="jieda" id="jieda">
          <?php if($answer) { ?>

              <?php foreach ($answer as $row) { ?>
                
              
              <li data-id="61452">
                <a name="item-1507281982325"></a>
                <div class="detail-about detail-about-reply">
                  <a class="fly-avatar" href="/u/6845664/">
                    <img src="/P201704/bbs/<?php echo $row['face']; ?>" alt="铁血总督"></a>
                  <div class="fly-detail-user">
                    <a href="/u/6845664/" class="fly-link">
                      <cite><?php echo $row['nickname']; ?></cite></a>
                  </div>
                  <div class="detail-hits">
                    <span><?php echo Ftime($row['ctime']); ?></span></div>
                </div>
                <div class="detail-body jieda-body photos">
                  <?php echo htmlspecialchars_decode($row['content']); ?></div>
                <div class="jieda-reply">
                  <span class="jieda-zan zan <?php if($row['is_zan']){ echo "zanok";} ?>" aid="<?php echo $row['aid']; ?>" type="zan">
                    <i class="iconfont icon-zan"></i>
                    <em><?php echo $row['zan_num']; ?></em></span>
                  <span nickname="<?php echo $row['nickname']; ?>" class="reply" type="reply">
                    <i class="iconfont icon-svgmoban53"></i><a href="#comment">回复</a></span>
                </div>
              </li>
              <?php } ?>
          <?php }else{ ?>
              <li class="fly-none">消灭零回复</li>
          <?php  }?>
          
        </ul>
        <div style="text-align: center"></div>
        <div class="layui-form layui-form-pane">
          <form action="/jie/reply/" method="post">
            <div class="layui-form-item layui-form-text">
              <a name="comment"></a>
              <div class="layui-input-block">
                <textarea id="L_content" name="content" required="" placeholder="请输入内容" class="layui-textarea fly-editor" style="height: 100px;"></textarea>
              </div>
            </div>
            <div class="layui-form-item">
              <input type="hidden" name="qid" value="<?php echo $ques['qid'] ?>">
              <button class="layui-btn" lay-filter="add" lay-submit="">提交回复</button></div>
          </form>
        </div>
      </div>
    </div>
    <div class="layui-col-md4">
      <dl class="fly-panel fly-list-one">
        <dt class="fly-panel-title">本周热议</dt>
        <?php foreach ($hotques as $row) { ?>
          <dd>
            <a href="<?php echo U('home/jie/index',array('qid'=>$row['qid']));?>"><?php echo $row['title'] ?></a>
            <span>
              <i class="iconfont icon-pinglun1"></i><?php echo $row['answer_num'] ?></span>
          </dd>
        <?php } ?>
      </dl>
      <div class="fly-panel">
        <div class="fly-panel-title">心级赞助商
          <span style="padding: 0 3px;">-</span>
          <a href="mailto:xianxin@layui.com?subject=%E5%92%A8%E8%AF%A2%20layui%E7%A4%BE%E5%8C%BA%20%E5%B9%BF%E5%91%8A%E8%B5%9E%E5%8A%A9%E5%95%86" class="fly-link fly-joinad    ">我要加入</a></div>
        <div class="fly-panel-main">
          <a href="http://www.fineui.com/" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: #205B95;" time-limit="2017.07.17-2018.07.18">FineUI - 9 年 ASP.NET 控件库</a>
          <a href="http://www.ideacms.net/" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: #FF7033;" time-limit="2017.09.25-2017.10.26">IdeaMall - 轻量型微商城/分销系统</a>
          <a href="http://layim.layui.com/?from=fly" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01">LayIM 3.0 - layui 旗舰之作</a></div>
      </div>
      <div class="fly-panel" style="padding: 20px 0; text-align: center;">
        <img src="//cdn.layui.com/upload/2017_8/168_1501894831075_19619.jpg" style="max-width: 100%;" alt="layui">
        <p style="position: relative; color: #666;">微信扫码关注 layui 公众号</p></div>
    </div>
  </div>
</div>
<script>//Demo
  layui.use(['form','layedit'
    ],function() {
    var form = layui.form;
    var layedit = layui.layedit;


    layedit.set({
      uploadImage: {
        url: '<?php echo U('home/jie/upload');?>' //接口url
        ,type: 'post' //默认post
      }
    });

    index  = layedit.build('L_content'); //建立编辑器


    // $('#LAY_layedit_1').css('height', '150px');


    // $('.layui-anim dd').click(function(event) {
    //     text = $(this).text();
    //     if(text=='提问'){
    //         $('.xbshide').show();
    //     }else{
    //         $('.xbshide').hide();
    //     }
    // });
    // 
    $('.reply').click(function(event) {
        nickname = $(this).attr('nickname'); 
        nickname = "@"+nickname;

        layedit.setContent(index,nickname);

        // window.location.hash= "#comment";
    });

    //收藏功能
    $('#collect').click(function(event) {
        qid = $(this).attr('qid');
        that =$(this);
        $.ajax({
        url: "<?php echo U('home/jie/collect');?>",
        type: 'POST',
        dataType: 'json',
        data: {qid:qid},
      })
      .done(function(res) {
        if(res.error==0){
          that.text("收藏");
          that.removeClass('layui-btn-danger');
        }else if(res.error==1){
           that.text("取消收藏");
           that.addClass('layui-btn-danger');
        }
      })
      .fail(function() {
        console.log("error");
      })
      .always(function() {
        console.log("complete");
      });
    });

    // 点赞
    $('.zan').click(function(event) {
        aid = $(this).attr('aid');
        num = parseInt($(this).children('em').text());
        that =$(this);
        $.ajax({
        url: "<?php echo U('home/jie/zan');?>",
        type: 'POST',
        dataType: 'json',
        data: {aid:aid},
      })
      .done(function(res) {
        if(res.error==0){
          num--;
          that.children('em').text(num);
          that.removeClass('zanok');
        }else if(res.error==1){
          num++;
          that.children('em').text(num);
          that.addClass('zanok');
        }
      })
      .fail(function() {
        console.log("error");
      })
      .always(function() {
        console.log("complete");
      });
    });

    //监听提交
    form.on('submit(add)',
    function(data) {

      data.field.content = layedit.getContent(index)

      // layer.msg(JSON.stringify(data.field));

      $.ajax({
        url: "<?php echo U('home/jie/addanser');?>",
        type: 'POST',
        dataType: 'json',
        data: data.field,
      })
      .done(function(res) {
        if(res.error==0){
            layer.alert(res.info, {icon: 6},function(){
                location.reload();
            });
        }else{
           layer.msg(res.info, function(){
            //关闭后的操作
            });
        }
      })
      .fail(function() {
        console.log("error");
      })
      .always(function() {
        console.log("complete");
      });

      return false;
    });
  });</script>


    <div class="fly-footer">
      <p>
        <a href="http://fly.layui.com/">
          Fly社区
        </a>
        2017 &copy;
        <a href="http://www.layui.com/">
          layui.com
        </a>
      </p>
      <p>
        <a href="http://fly.layui.com/jie/3147.html" target="_blank">
          产品授权
        </a>
        <a href="http://fly.layui.com/jie/8157.html" target="_blank">
          获取Fly社区模版
        </a>
        <a href="http://fly.layui.com/jie/2461.html" target="_blank">
          微信公众号
        </a>
      </p>
    </div>
  </body>

</html>
<script>
//注意：导航 依赖 element 模块，否则无法进行功能性操作
layui.use('element', function(){
  var element = layui.element;
  
  //…
});
</script>